<?php
namespace Admin\Controller;
use Think\PageAdmin;
use Common\Support\Curl;
use Think\Upload;

/**
 * 活动管理控制器
 */
class ActivityController extends BaseController
{
	/**
     * 初始化
     * 
     * @return [type] [description]
     */
    public function _initialize()
    {
        parent::_initialize();       
    }

   	/**
   	 * 活动管理信息
   	 * @return [type] [description]
   	 */
    public function index(){
        $prefix = C('DB_PREFIX');

        $count = M('activity')->count();
        $page  = new PageAdmin($count, C('PAGE_NUM'));

        $pages['show']  = $page->show();  //分页输出
        $pages['total'] = $count;  //总数
        $pages['lists'] = M('activity a')
            ->order("a.id desc")
            ->limit($page->firstRow.','.$page->listRows)
            ->select();

        $this->seotitle = '活动列表';
        $this->pages    = $pages;
        $this->display();
    }

    /**
     * 活动详情
     */
    public function detail(){
        $id = I('id');

        $activity_info = M("activity")->where(['id'=>$id])->find();

        //审核员信息
        $audit_info = M("audit")->where(["id"=>$activity_info['audit_user_id']])->find();
        //下单情况
        $order_info = M("order")->where(["activity_id"=>$activity_info['id']])->select();

        $this->activity_info = $activity_info;
        $this->audit_info = $audit_info;
        $this->order_info = $order_info;
        $this->seotitle = '活动详情';
        $this->display();
    }

   
}